const mongoose = require("mongoose");
module.exports = app => {
    return new Promise((resolve, reject) => {
        mongoose
            .connect("mongodb://127.0.0.1:27017/vansir", {
                useUnifiedTopology: true,
                useNewUrlParser: true,
                useFindAndModify: false,
            })
            .then(res => {
                resolve(res);
                console.log("数据库连接成功");
            })
            .catch(err => {
                reject(err);
                console.log("数据库连接失败");
            });
    });
};
